package com.wym.charging.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 用户表(User)表实体类
 *
 * @author WangYimin
 * @since 2024-12-07 19:02:11
 */
@TableName("user")
@Data
@Schema(description = "用户实体类")
public class User extends Model<User> implements Serializable{
    @TableId
    @Schema(description = "用户ID")
    private Integer id;
    @Schema(description = "用户名")
    private String username;
    @Schema(description = "密码")
    @JsonIgnore
    private String password;
    @Schema(description = "归属小区")
    private String belongingCommunity;
    @Schema(description = "账户余额")
    private BigDecimal accountBalance;
    @Schema(description = "赠送余额")
    private BigDecimal giftBalance;
    @Schema(description = "赠送时长 单位：分钟")
    private Integer giftDuration;
    @Schema(description = "是否包月 0否 1是")
    private Boolean monthlySubscription;
    @Schema(description = "包月剩余时长 单位：分钟")
    private Integer remainingTime;
    @Schema(description = "包月结束时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime subscriptionEndTime;
    @Schema(description = "用户头像")
    private String userAvatar;
    @Schema(description = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    @Schema(description = "更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;
    @Schema(description = "假删标识")
    @TableField(fill = FieldFill.INSERT)
    @TableLogic
    private Boolean isDel;

    /**
     * 获取主键值
     *
     * @return 主键值
     */
    @Override
    public Serializable pkVal() {
        return this.id;
    }
}

